<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>[%$softtitle%]</title>
<link href="templates/css/baselist.css" rel="stylesheet" type="text/css" />
<link href="templates/css/all.css" rel="stylesheet" type="text/css" />
<link href="templates/css/jcrop.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/control.js"></script>
<script type="text/javascript" src="js/form.js"></script>
<script type="text/javascript" src="js/dialog.js"></script>
<script type="text/javascript" src="js/jcrop.js"></script>
<script type="text/javascript" src="js/imagejcrop.js"></script>
<script type="text/javascript" language="JavaScript">
var filemanage_js_newimagename_empty  = "[%$ST.filemanage_js_newimagename_empty%]";
var filemanage_js_size_empty  = "[%$ST.filemanage_js_size_empty%]";
var filemanage_js_edit_ok = "[%$ST.filemanage_js_edit_ok%]";
var filemanage_js_edit_no = "[%$ST.filemanage_js_edit_no%]";
var filemanage_js_zoomwidthbig_empty = "[%$ST.filemanage_js_zoomwidthbig_empty%]";
var filemanage_js_zoomheightbig_empty = "[%$ST.filemanage_js_zoomheightbig_empty%]";
$(window).load(function(){
	var h = $(window).height();

	var jcrop_api;
	initJcrop();
	function initJcrop(){
		jcrop_api = $.Jcrop('#cropbox',{

			onChange: updateCoords,
			onSelect: updateCoords
		});
	};
	$('#release').click(function(e) {
		jcrop_api.release();
	});
	var options = {
		beforeSubmit: formverify,
		success:saveResponse
	}
	$('#filecheck').submit(function() {
		$(this).ajaxSubmit(options);
		return false;
	});
});




function formverify(formData, jqForm, options) {
	var queryString = $.param(formData);
	var get=urlarray(queryString);
	if(get['newimagename'].match(/^[\w.]+$/ig)==null) {
		document.filecheck.newimagename.focus();
		alert(filemanage_js_newimagename_empty);
		return false;
	}
	if(get['w'].match(/^[0-9]+$/ig)==null || get['h'].match(/^[0-9]+$/ig)==null || get['x'].match(/^[0-9]+$/ig)==null || get['y'].match(/^[0-9]+$/ig)==null) {
		alert(filemanage_js_size_empty);
		return false;
	}
	windowsdig('Loading','iframe:index.php?archive=management&action=load','400px','180px','iframe',false);
}

function saveResponse(options,post){
	if (options=='true'){
		parent.refresh('filemodelattselectform','selectall','check_all');
		alert(filemanage_js_edit_ok);
		parent.closeifram();
	}else{
		alert(filemanage_js_edit_no);
		parent.closeifram();
	}
}
</script>
<!--[if IE 6]>
<style type="text/css" media="screen"> 
body { behavior:url("templates/css/csshover.htc");} 
</style> 
<![endif]-->
</head>

<body class="bodyflow">
<div class="centerrightwindow2">
	<form name="filecheck" id="filecheck" method="post" action="index.php?archive=filemanage&action=imgagecut">
	<input type="hidden" name="path" id="path" value="[%$path%]"/>
	<input type="hidden" name="imgname" id="imgname" value="[%$imgname%]"/>
	<input type="hidden" name="imgW" id="imgW" value="[%$srcW%]"/>
	<input type="hidden" name="imgH" id="imgH" value="[%$srcH%]"/>
	<div id="mainwindowhidden">
		<div class="suggestion">
			<span class="sugicon"><span class="strong colorgorning2">[%$ST.position_title%]</span><span class="padding-left5 colorgorningage">[%$ST.filemanage_file_zoom_botton_title%]</span></span>
		</div>
		<div class="sugtitle-line"></div>
		<div class="formdiv" id="filecheckmanger">
			<table border="0" width="100%">
				<tr class="trstyle2">
					<td class="trtitle01">[%$ST.filemanage_file_imgname_title%]</td>
					<td class="trtitle02">[%$imgname%]</td>
				</tr>
				<tr class="trstyle2">
					<td class="trtitle01">[%$ST.filemanage_file_selecton_title%]</td>
					<td class="trtitle02"><input type="radio" value="1" name="selecton"> [%$ST.is_yes%]&nbsp;<input type="radio" value="0" name="selecton" checked> [%$ST.is_no%]</td>
				</tr>
				<tr class="trstyle2">
					<td class="trtitle01">[%$ST.filemanage_file_newimagename_title%]</td>
					<td class="trtitle02"><input type="text" name="newimagename" value="[%$newfilename%]" maxlength="100" size="40" class="infoInput" style="ime-mode:disabled"></td>
				</tr>
				<tr class="trstyle2">
					<td class="trtitle01">[%$ST.filemanage_file_zoombotton_title%]</td>
					<td class="trtitle02">
						[%$ST.filemanage_file_zoombotton_width%]<input id="dstW" class="infoInput" type="text" name="dstW" maxlength="3" size="3" value="[%$srcW%]"  onBlur="javascript:imagesizew();" style="ime-mode:disabled" onkeydown="if(event.keyCode==13)event.keyCode=9" onKeyPress="if ((event.keyCode<48 || event.keyCode>57)) event.returnValue=false"/>
						[%$ST.filemanage_file_zoombotton_height%]<input id="dstH" class="infoInput" type="text" name="dstH" maxlength="3" size="3" value="[%$srcH%]" onBlur="javascript:imagesizeh();" style="ime-mode:disabled" onkeydown="if(event.keyCode==13)event.keyCode=9" onKeyPress="if ((event.keyCode<48 || event.keyCode>57)) event.returnValue=false"/>
						<input type="button" id="chenimage" class="bottons02" name="chenimage" onclick="imagezoom('#imagelist','[%$ST.filemanage_file_zoombotton_mess%]');" value="[%$ST.filemanage_file_zoombotton%]"/>
					</td>
				</tr>
				<tr class="trstyle2">
					<td colspan="2" style="padding:5px;" align="center"><span id="imagelist"><img id="cropbox" src="[%$url%][%$imgname%]"></span></td>
				</tr>
				<tr class="trstyle2" id="select1">
					<td class="trtitle01">[%$ST.filemanage_file_zoom_info%]</td>
					<td class="trtitle02" align="left">
						[%$ST.filemanage_file_zoombotton_width%]<input type="text" id="w" name="w" size="3" class="infoInput"/>
						[%$ST.filemanage_file_zoombotton_height%]<input type="text" id="h" name="h" size="3" class="infoInput"/>
						[%$ST.filemanage_file_zoombotton_x%]<input type="text" id="x" name="x" size="3" class="infoInput"/>
						[%$ST.filemanage_file_zoombotton_y%]<input type="text" id="y" name="y" size="3" class="infoInput"/>
					</td>
				</tr>
			</table>
		</div>
	</div>
	<div id="downbotton">
		<div id="subbotton">
			<table border="0" width="100%">
				<tr id="bottonsubmit">
					<td id="right"><input type="submit" name="Submit" id="submitbotton" value="[%$ST.filemanage_file_submit_botton%]" class="buttonface" title="[%$ST.filemanage_file_submit_botton%]"/></td>
					<td id="left" class="padding-left5"><input type="reset" name="reset" id="release" value="[%$ST.filemanage_file_res_botton%]" class="buttonface"  title="[%$ST.filemanage_file_res_botton%]" /></td>
				</tr>
			</table>
		</div>
	</div>
	</form>
</div>
</body>
</html>